package cn.tedu.rabbitmqboot.m1;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class Producer {
    @Autowired
    private AmqpTemplate amqpTemplate;
    //send方法需要手动调用,发送消息
    public void send(){//自定义的方法
        //String->Byte[]->helloworld队列
        amqpTemplate.convertAndSend("helloworld","Hello World!");
        System.out.println("消息已发送");
    }

}
